package com.zhengsr.wanandroid;

import android.app.Application;
import android.os.Handler;
import android.os.Looper;

import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.fonts.FontAwesomeModule;
import com.joanzapata.iconify.fonts.IoniconsModule;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
import com.squareup.leakcanary.LeakCanary;
import com.zhengsr.CoreManager;
import com.zhengsr.corelib.utils.WanAndroidAPI;

/**
 * Created by zhengshaorui
 * time: 2018/8/19
 */

public class MainApplication extends Application {


    static Handler sHandler = new Handler(Looper.myLooper());
    @Override
    public void onCreate() {
        super.onCreate();
        CoreManager.configBuilder()
                .setContext(this)
                .setHandler(sHandler)
                .setBaseUrl(WanAndroidAPI.BASE_URL)
                .builder();
        FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
                .tag("WanAndroid")   // (Optional) Global tag for every log. Default PRETTY_LOGGER
                .build();
        //log
        Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy));
        //字体
        Iconify.with(new FontAwesomeModule())
                .with(new IoniconsModule());

        if (LeakCanary.isInAnalyzerProcess(this)) {
            // This process is dedicated to LeakCanary for heap analysis.
            // You should not init your app in this process.
            return;
        }
        LeakCanary.install(this);
    }
}
